import java.util.Scanner;

/**
 * @program: data_structures_algorithms
 * @description:
 * @author: lld
 * @create: 2020/08/19 19:43
 **/
public class Demo1 {
    public static void main(String[] args) {
        while (true) {
            System.out.println("请问需要输出斐波那契数列的前多少项？");
            Scanner scanner = new Scanner(System.in);
            int n = scanner.nextInt();
            for (int i = 1; i <= n; i++) {
                System.out.print(Fibonacci(i) + " ");
            }
            System.out.println();
        }
//        long s3 = System.currentTimeMillis();
//        System.out.println("1*2*···*10="+test2(10));
//        long e3 = System.currentTimeMillis();
//        System.out.println("while循环："+(e3-s3));
//        long s1 = System.currentTimeMillis();
//        System.out.println("1*2*···*10="+test(10));
//        long e1 = System.currentTimeMillis();
//        System.out.println("递归："+(e1-s1));
//
//        long s2 = System.currentTimeMillis();
//        System.out.println("1*2*···*10="+test1(10));
//        long e2 = System.currentTimeMillis();
//        System.out.println("for循环："+(e2-s2));

    }

    public static int Fibonacci(int n) {
        if (n <= 2) {
            return 1;
        } else {
            return Fibonacci(n - 1) + Fibonacci(n - 2);
        }
    }

    public static int test(int i) {
        //
        int a = 1;
        if (i > 0) {
            a = i * test(i - 1);
        }
        return a;
    }

    public static int test1(int i) {
        //
        int res = 1;
        for (int j = 1; j <= i; j++) {
            res *= j;
        }
        return res;
    }

    public static int test2(int i) {
        //
        int res = 1;
        while (0 < i) {
            res *= i;
            i--;
        }
        return res;
    }
}
